{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%pip install pydantic\n",
    "%pip install googlemaps"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from main import handle_location_question, handle_vision_question, app"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%pip install llama_index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# from llama_index.agent.openai import OpenAIAgent\n",
    "from llama_index.core.tools.tool_spec.base import BaseToolSpec"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "class CVToolSpec(BaseToolSpec):\n",
    "    spec_functions = ['handle_vision_question']\n",
    "\n",
    "    def __init__(self): #, form):\n",
    "        # self.form = form\n",
    "        ''''''\n",
    "\n",
    "    def handle_vision_question(request):\n",
    "        return handle_vision_question(request)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "cv_tool = CVToolSpec()\n",
    "cv_tool_list = cv_tool.to_tool_list()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "class LocationToolSpec(BaseToolSpec):\n",
    "    spec_functions = ['handle_location_question']\n",
    "\n",
    "    def __init__(self): #, form):\n",
    "        # self.form = form\n",
    "        ''''''\n",
    "\n",
    "    def handle_location_question(request): \n",
    "        return handle_location_question(request)\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from flask import request \n",
    "\n",
    "# form_data = request.form\n",
    "\n",
    "loc_tool = LocationToolSpec()\n",
    "loc_tool_list = loc_tool.to_tool_list(['handle_location_question'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# from {KG repo} import {KG query method}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "class SearchToolSpec(BaseToolSpec):\n",
    "    spec_functions = ['']\n",
    "\n",
    "    def __init__(self):\n",
    "        ''''''\n",
    "\n",
    "    def handle_search_request(request):\n",
    "        return handle_search_request(request)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Experiment with making Agents from Tools"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from llama_index.agent.openai import OpenAIAgent\n",
    "from llama_index.llms.openai import OpenAI\n",
    "\n",
    "full_tool_list = cv_tool.to_tool_list() + loc_tool.to_tool_list()\n",
    "llm = OpenAI(model=\"gpt-3.5-turbo\")\n",
    "agent = OpenAIAgent.from_tools(full_tool_list, verbose=True)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
